<?php
class Controller {
	/** Protected variables **/
	protected $_model;
	protected $_controller;
	protected $_action;
	protected $_template;
	
	function __construct($model, $controller, $action) {
		$this->_controller = $controller;
		$this->_action = $action;
		$this->_model = $model;
		
		if($this->_model !== 'none') {
			$this->$model = new $model;	
		}
		
		if($this->_action == NULL) {
			$this->_action = 'index';
		}
		echo $this->_action;
		$this->_template = new Template($this->_controller,$this->_action);
	}
	
	function set($name, $value) {
		$this->_template->set($name, $value);
	}

	function __destruct() {
		$this->_template->render();
	}
}